using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MimeCloud.AssetManagement.Business;
using MimeCloud.AssetManagement.Business.Interface;
using MimeCloud.AssetManagement.ProviderServices;

namespace MimeCloud.AssetManagement.DigitalLibrary.Dialogs
{
    /// <summary>
    /// Interaction logic for OpenAssetById.xaml
    /// </summary>
    public partial class OpenAssetById : AssetOpenerWindowBase
    {
        public OpenAssetById()
        {
            InitializeComponent();
        }

        private void btnOpen_Click(object sender, RoutedEventArgs e)
        {
            int imageId = -1;
            if (Int32.TryParse(usrAssetID.Text, out imageId))
            {
                IAsset fromProvider = AssetManagerConfig.GetAssetReaderProvider().GetAssetByID(imageId);
                OpenAssetsInParent(new List<IAsset>{fromProvider});
            }
            else
            {
                MessageBox.Show("Please enter a valid ID");
            }

        }
    }
}
